{% extends "extend/base.html" %} <!--继承模板-->
{% block page_content %}
	{% if current_user.is_authenticated %}
		<h1>Hello, {{ user.username }}!</h1>
	{% endif %}			
	<div class="col-md-2" >
		<div id="links" class="list-group">
		  <a href="#" class="list-group-item active">用户信息</a>
		  <!--	  
		  <a href="#" class="list-group-item">修改密码</a>
		  <a href="#" class="list-group-item">修改邮箱</a>	  
		  -->
		</div>
	</div>
	<div class="col-md-10" >
		<div id="contentPanel" class="panel panel-success">
		  <div class="panel-heading">用户信息</div>
		  <div class="panel-body">	  	
		    <p>用户名:{{ user.username}}</p>
			<p>地址:{{ user.location}}</p>
			<p>邮箱:{{ user.email}} {% if current_user.is_authenticated %}<a href="">修改</a>{% endif %}</p>
			<p>个人简介:{{ user.about_me}}</p>
			{% if current_user.is_authenticated and current_user.id==user.id  %}
				<p><a href="{{ url_for('main.editProfile') }}">修改资料</a>   <a href="">修改密码</a></p>
			{% endif %}			
			{% if current_user.is_admin() %}
				<a class="btn btn-danger"
				href="{{ url_for('admin.editProfileAdmin', id=user.id) }}">
					修改资料[管理员]			
				</a>
			{% endif %}

			{% if current_user.is_authenticated %}
				<h4>我的博客</h4>
				{{ macro.randerPost(posts,moment,current_user) }}
				{{ macro.pagination_widget(pagination,'main.user',username=user.username) }}
			{% endif %}
			
		  </div>
		</div>
	</div>

{% endblock %}

{% block scripts %}
	{{ super() }}	
	<script type="text/javascript">	
		//设置panel里面的导航选中状态
		var links =	$("#links a")	
		var preA = links[0] //默认选中第一个
		$("#links a").on('click',clickLink)
		function clickLink(){
			if (preA) {
				$(preA).removeClass('active')
			}
			preA = this
			$(this).addClass('active')			
			$(".panel-heading").text($(this).text())
			var i = $(this).index() //获取当前点击的下标			
					 
		}		
	</script>

{% endblock %}

{% block select_nav %}		
	selectPage(1);
{% endblock %}